#ifndef DRAND48_H
#define DRAND48_H

#include <stdlib.h>

#define m_ 0x100000000LL
#define c_ 0xB16
#define a_ 0x5DEECE66DLL

static unsigned long long seed_ = 1;

double drand48(void)
{
	seed_ = (a_ * seed_ + c_) & 0xFFFFFFFFFFFFLL;
	unsigned int x = seed_ >> 16;
    return 	((double)x / (double)m_);

}

void srand48(unsigned int i)
{
    seed_  = (((long long int)i) << 16) | rand();
}

#endif
